package com.snopy.designPattern.structure.adapter;

import com.snopy.designPattern.structure.adapter.impl.Mp4Player;
import com.snopy.designPattern.structure.adapter.impl.VlcPlayer;

/**
 * @author snopy
 * @version 1.0.0
 * @classname MediaAdapter
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/02 14:03
 */
public class MediaAdapter implements MediaPlayer{


    private AdvancedMediaPlayer advancedMediaPlayer;

    public MediaAdapter(String type) {
        if (type.equalsIgnoreCase("MP4")){
            advancedMediaPlayer = new Mp4Player();
        }else if (type.equalsIgnoreCase("VLC")){
            advancedMediaPlayer = new VlcPlayer();
        }
    }

    @Override
    public void play(String type, String file) {
        if (type.equalsIgnoreCase("MP4")){
            advancedMediaPlayer.playMp4(type,file);
        }else if (type.equalsIgnoreCase("VLC")){
            advancedMediaPlayer.playVLC(type,file);
        }

    }
}
